package com.dongdongshop.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdongshop.constant.HttpResultEnum;
import com.dongdongshop.data.DataResult;
import com.dongdongshop.pojo.seller.TbSeller;
import com.dongdongshop.service.seller.SellerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("sellerController")
public class SellerController {

    private final Logger log = LoggerFactory.getLogger(SellerController.class);

    @Reference
    private SellerService sellerService;

    /*
    * 注册
    * */
    @RequestMapping("registerSeller")
    @ResponseBody
    public DataResult registerSeller(TbSeller tbSeller){ //商家注册
        try {
            sellerService.registerSeller(tbSeller);
        }catch (Exception e){
            log.error("商家注册:",e);
            return new DataResult(HttpResultEnum.ERROR.getCode(),HttpResultEnum.ERROR.getMessage());
        }
        return new DataResult(HttpResultEnum.SUCCESS.getCode(),HttpResultEnum.SUCCESS.getMessage());
    }
}
